<?php
/**
 * 后台用户控制器
 * User: pengyx
 * Date: 2018/09/02
 * Time: 13:48
 */

namespace app\admin\controller;


use think\Request;

class Users extends Common
{
    public function _initialize()
    {
        $this->view->engine->layout(false);
    }

    public function index(Request $request)
    {
        if(!$request->isAjax()) {
            return $this->fetch();
        } else {
            $this->getUsertList();
        }
    }

    public function getUsertList()
    {
        $this->diesuccess('ok',[]);
    }

    public function userAdd(Request $request)
    {
        if(!$request->isAjax())
        {
            return $this->fetch();
        }
        else
        {
            $this->doUserAdd($request->post());
        }

    }

    public function doUserAdd($args)
    {
        $this->dieerror('添加失败');
        $this->diesuccess('添加成功',$args);
    }

}